﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WCFPointOfSaleService.Entities
{
    public class Order
    {
        public int orderIdLocal;
        public int orderId;
        public int clientIdLocal;
        public int clientId;
        public string usernameTransaction;
        public string uuidTransaction;
        public string creationDate;
        public string deliveryDate;
        public string typeUserTransaction;
        public bool isSendInvoice;
        public decimal total;
        public decimal discount;
        public decimal totalDiscount;
        public decimal taxes;
        public decimal totalTaxes;
        public decimal totalToPay;
        public string status;

        public List<OrderByStock> orderByStockList;

        public Order()
        {
            this.orderIdLocal = -1;
            this.orderId = -1;
            this.clientIdLocal = -1;
            this.clientId = -1;
            this.usernameTransaction = string.Empty;
            this.uuidTransaction = string.Empty;
            this.typeUserTransaction = string.Empty;
            this.isSendInvoice = true;
            this.total = 0;
            this.discount = 0;
            this.totalDiscount = 0;
            this.taxes = 0;
            this.totalTaxes = 0;
            this.totalToPay = 0;
            this.status = "PEN";

            this.orderByStockList = new List<OrderByStock>();
        }

        public DateTime DeliveryDate
        {
            get
            {
                if (deliveryDate != null)
                    return Convert.ToDateTime(deliveryDate); ;
                return Convert.ToDateTime(creationDate);
            }

            set
            {
                if (value != null)
                    deliveryDate = Convert.ToString(value);
            }
        }

        public DateTime CreationDate
        {
            get
            {
                return Convert.ToDateTime(creationDate); ;
            }

            set
            {
                if (value != null)
                    creationDate = Convert.ToString(value);
            }
        }

    }
}